home *** CD-ROM | disk | FTP | other *** search
/ Dermatology Step by Step / Dermatology Step by Step.iso / pc / Media / Main.dxr / 00001.ls next >
Encoding:
Text File  |  2001-02-16  |  17.2 KB  |  533 lines

  1. property spriteNum
  2. global isMac, isPC, gDir, gInstaller, gFileName, gIconName, gIconLink, gInstallerSelected, gBrowser, gBrowserFound, gOpenDefaultBrowser, gPlugins, gScreenRes, gWebPage, gDisclaimer, gRequired, gBrowserPresent, gPluginsPresent
  3.  
  4. on startMovie
  5.   buddyAPI = baRegister("MIS ICAXON", 2710890)
  6.   isMac = the platform contains "Mac"
  7.   isPC = not isMac
  8.   sprite(2).visible = isMac
  9.   sprite(4).visible = isMac
  10.   gFileName = "kaiser.mypatient.com"
  11.   gIconName = "kaiser.mypatient.ico"
  12.   gIconLink = "KAISER~1"
  13.   gRequired = [:]
  14.   gRequired[#vNS] = 4
  15.   gRequired[#vIE] = 5
  16.   gRequired[#vAO] = 5
  17.   gRequired[#vNS_mac] = 4
  18.   gRequired[#vIE_mac] = 6
  19.   gRequired[#vAO_mac] = 5
  20.   gRequired[#vSW] = 8
  21.   gRequired[#vFL] = 5
  22.   gRequired[#W] = 800
  23.   gDir = [:]
  24.   gDir[#dialog] = EMPTY
  25.   gWebPage = [:]
  26.   gWebPage[#mainPage] = "http://" & gFileName & "/"
  27.   gWebPage[#help_desk] = "http://" & gFileName & "/mypatient/PublicSite/help_desk/"
  28.   gInstaller = [:]
  29.   gInstaller[#selected] = 1
  30.   if isMac then
  31.     gInstaller[#IE] = the moviePath & ":installers:Internet Explorer 5.smi"
  32.     gInstaller[#NS] = the moviePath & ":installers:Communicator‚Ñ¢ 4.75 Complete:* Start Here *"
  33.     gInstaller[#PL] = the moviePath & ":installers:Shockwave Installer"
  34.     gDisclaimer = the moviePath & "disclaimer:disclaimer.htm"
  35.   else
  36.     gInstaller[#IE] = the moviePath & "..\installers\Internet Explorer 5.0\ie5setup.exe"
  37.     gInstaller[#NS] = the moviePath & "..\installers\Netscape 4.5\setup.exe"
  38.     gInstaller[#PL] = the moviePath & "..\installers\Shockwave_Installer_Full.exe"
  39.     gDisclaimer = the moviePath & "disclaimer\disclaimer.htm"
  40.   end if
  41.   gBrowserFound = EMPTY
  42.   gBrowser = [:]
  43.   gPlugins = [:]
  44.   gScreenRes = [:]
  45.   gotoNextStep()
  46. end
  47.  
  48. on gotoNextStep
  49.   cursor(4)
  50.   gBrowser = detectBrowser(EMPTY)
  51.   gPlugins = detectPlugins(gBrowser[#Path], gBrowser[#type])
  52.   gScreenRes = detectScreenResolution()
  53.   if not (gBrowser[#Ok] and gBrowser[#vOK]) then
  54.     nextScreen = "InstallBrowser"
  55.   else
  56.     if not gPlugins[#Ok] then
  57.       nextScreen = "InstallPlugins"
  58.     else
  59.       nextScreen = "Open"
  60.     end if
  61.   end if
  62.   go(nextScreen)
  63.   cursor(-1)
  64. end
  65.  
  66. on unQuote str
  67.   if str.char[1] = QUOTE then
  68.     str = str.char[2..str.length - 1]
  69.   end if
  70.   return str
  71. end
  72.  
  73. on detectBrowser
  74.   browser = [#Ok: 0, #vOK: 0, #Path: EMPTY, #type: EMPTY]
  75.   gBrowserFound = EMPTY
  76.   if isPC then
  77.     defaultBrowser = baReadRegString(".htm", EMPTY, EMPTY, "HKEY_CLASSES_ROOT")
  78.     defaultPath = unQuote(baReadRegString(defaultBrowser & "\shell\open\command", EMPTY, EMPTY, "HKEY_CLASSES_ROOT").word[1])
  79.     defaultVersion = baFileVersion(defaultPath).char[1..4]
  80.     browser[#Ok] = (defaultBrowser = "NetscapeMarkup") or (defaultBrowser = "htmlfile") or (defaultBrowser = "aolfile_HTM")
  81.     browser[#Path] = defaultPath
  82.     case defaultBrowser of
  83.       "NetscapeMarkup":
  84.         defaultBrowser = "Netscape"
  85.         browser[#vOK] = defaultVersion.char[1] = gRequired[#vNS]
  86.         browser[#type] = "NS"
  87.       "htmlfile":
  88.         defaultBrowser = "Internet Explorer"
  89.         browser[#vOK] = defaultVersion.char[1] >= gRequired[#vIE]
  90.         browser[#type] = "IE"
  91.       "aolfile_HTM":
  92.         defaultBrowser = "America Online"
  93.         browser[#vOK] = defaultVersion.char[1] >= gRequired[#vAO]
  94.         browser[#type] = "AO"
  95.     end case
  96.     gOpenDefaultBrowser = browser[#Ok] and browser[#vOK]
  97.     if not gOpenDefaultBrowser then
  98.       NSpath = unQuote(baReadRegString("NetscapeMarkup\shell\open\command", EMPTY, EMPTY, "HKEY_CLASSES_ROOT").word[1])
  99.       IEpath = unQuote(baReadRegString("htmlfile\shell\open\command", EMPTY, EMPTY, "HKEY_CLASSES_ROOT").word[1])
  100.       AOpath = unQuote(baReadRegString("aolfile_HTM\shell\open\command", EMPTY, EMPTY, "HKEY_CLASSES_ROOT").word[1])
  101.     end if
  102.   else
  103.     gOpenDefaultBrowser = 0
  104.     NSpath = baFindApp("MOSS")
  105.     IEpath = baFindApp("MSIE")
  106.     AOpath = baFindApp("AOp3")
  107.     browser[#Path] = baFindApp("MOSS")
  108.     browser[#type] = "NS"
  109.     browser[#Ok] = browser[#Path] <> EMPTY
  110.     browser[#vOK] = baFileVersion(browser[#Path]).char[1] = gRequired[#vNS_mac]
  111.     if not (browser[#Ok] and browser[#vOK]) then
  112.       browser[#Path] = baFindApp("AOp3")
  113.       browser[#type] = "AO"
  114.       browser[#Ok] = browser[#Path] <> EMPTY
  115.       browser[#vOK] = baFileVersion(browser[#Path]).char[1] >= gRequired[#vAO_mac]
  116.     end if
  117.     if not (browser[#Ok] and browser[#vOK]) then
  118.       browser[#Path] = baFindApp("MSIE")
  119.       browser[#type] = "IE"
  120.       browser[#Ok] = browser[#Path] <> EMPTY
  121.       browser[#vOK] = baFileVersion(browser[#Path]).char[1] >= gRequired[#vIE_mac]
  122.     end if
  123.   end if
  124.   if not (browser[#Ok] and browser[#vOK]) then
  125.     brwCount = 0
  126.     gBrowserFound = EMPTY
  127.     browser[#Ok] = 0
  128.     browser[#vOK] = 0
  129.     if NSpath <> EMPTY then
  130.       gBrowserFound = gBrowserFound & "Netscape version [" & baFileVersion(NSpath).char[1..4] & "]" & RETURN
  131.       browser[#Ok] = 1
  132.       browser[#vOK] = baFileVersion(NSpath).char[1] = gRequired[#vNS]
  133.       browser[#type] = "NS"
  134.       browser[#Path] = NSpath
  135.       brwCount = brwCount + 1
  136.     end if
  137.     if not (browser[#Ok] and browser[#vOK]) and (IEpath <> EMPTY) then
  138.       versionIE = baFileVersion(IEpath).char[1..4]
  139.       if versionIE = "4.70" then
  140.         versionIE = "3.0"
  141.       end if
  142.       if versionIE = "4.72" then
  143.         versionIE = "4.0"
  144.       end if
  145.       gBrowserFound = gBrowserFound & "Internet Explorer version [" & versionIE & "]" & RETURN
  146.       browser[#Ok] = 1
  147.       browser[#vOK] = baFileVersion(IEpath).char[1] >= gRequired[#vIE]
  148.       browser[#type] = "IE"
  149.       browser[#Path] = IEpath
  150.       brwCount = brwCount + 1
  151.     end if
  152.     if not (browser[#Ok] and browser[#vOK]) and (AOpath <> EMPTY) then
  153.       gBrowserFound = gBrowserFound & "America Online version [" & baFileVersion(AOpath).char[1..4] & "]" & RETURN
  154.       browser[#Ok] = 1
  155.       browser[#vOK] = baFileVersion(AOpath).char[1] >= gRequired[#vAO]
  156.       browser[#type] = "AO"
  157.       browser[#Path] = AOpath
  158.       brwCount = brwCount + 1
  159.     end if
  160.     if brwCount = 0 then
  161.       gBrowserFound = "We have not detected a browser on your computer." & RETURN & "We recommend that you install the browser included on this CD."
  162.     else
  163.       if brwCount = 1 then
  164.         gBrowserFound = "The browser detected on your computer is" & RETURN & RETURN & gBrowserFound & RETURN & "However, this browser is not compatible with the Dermatology Step By Step program." & RETURN & RETURN & "We recommend that you install the browser included on this CD."
  165.       else
  166.         gBrowserFound = "The browsers detected on your computer are" & RETURN & RETURN & gBrowserFound & RETURN & "However, these browsers are not compatible with the Dermatology Step By Step program." & RETURN & RETURN & "We recommend that you install the browser included on this CD."
  167.       end if
  168.     end if
  169.   end if
  170.   return browser
  171. end
  172.  
  173. on old_detectBrowser Path
  174.   browser = [#Ok: 0, #vOK: 0, #Path: EMPTY, #type: EMPTY]
  175.   if isMac then
  176.     browser[#Path] = baFindApp("MOSS")
  177.     browser[#type] = "NS"
  178.     browser[#Ok] = browser[#Path] <> EMPTY
  179.     browser[#vOK] = baFileVersion(browser[#Path]).char[1] = gRequired[#vNS_mac]
  180.     if not browser[#vOK] then
  181.       browser[#Path] = baFindApp("AOp3")
  182.       browser[#type] = "AO"
  183.       browser[#Ok] = browser[#Path] <> EMPTY
  184.       browser[#vOK] = baFileVersion(browser[#Path]).char[1] >= gRequired[#vAO_mac]
  185.     end if
  186.     if not browser[#vOK] then
  187.       browser[#Path] = baFindApp("MSIE")
  188.       browser[#type] = "IE"
  189.       browser[#Ok] = browser[#Path] <> EMPTY
  190.       browser[#vOK] = baFileVersion(browser[#Path]).char[1] >= gRequired[#vIE_mac]
  191.     end if
  192.   else
  193.     browser[#Path] = Path
  194.     if browser[#Path].length = 0 then
  195.       browser[#Path] = baFindApp("htm")
  196.     end if
  197.     browser[#Ok] = browser[#Path] <> EMPTY
  198.     if browser[#Ok] then
  199.       v = baFileVersion(browser[#Path])
  200.       File = getFile(browser[#Path])
  201.       if File contains "explore" then
  202.         browser[#type] = "IE"
  203.       end if
  204.       if File contains "netscape" then
  205.         browser[#type] = "NS"
  206.       end if
  207.       if browser[#type] = "IE" then
  208.         browser[#vOK] = v.char[1] >= gRequired[#vIE]
  209.       else
  210.         if browser[#type] = "NS" then
  211.           browser[#vOK] = v.char[1] = gRequired[#vNS]
  212.         end if
  213.       end if
  214.     end if
  215.   end if
  216.   return browser
  217. end
  218.  
  219. on detectPlugins brwPath, brwType
  220.   plugins = [#Ok: 0]
  221.   if brwType = "IE" then
  222.     if isMac then
  223.       brwPluginFolder = getDir(brwPath) & "Plug-ins:"
  224.       flFileA = brwPluginFolder & "Shockwave Flash NP-PPC"
  225.       flFileB = baSysFolder("extensions") & "Macromedia:Shockwave 8:Xtras:Flash Asset PPC"
  226.       flExist = baFileExists(flFileA) or baFileExists(flFileB)
  227.       flVersA = baFileVersion(flFileA)
  228.       flVersB = baFileVersion(flFileB)
  229.       flVers = flVersA
  230.       if flVersB.char[1] >= 4 then
  231.         flVers = flVersB
  232.       end if
  233.       swFile = baSysFolder("extensions") & "Macromedia:Shockwave 8:Xtras:SWA Streaming PPC Xtra"
  234.       swExist = baFileExists(swFile)
  235.       swVers = baFileVersion(swFile)
  236.     else
  237.       flFile = baSysFolder("system") & "Macromed\Flash\SWFlash.ocx"
  238.       flExist = baFileExists(flFile)
  239.       flVers = baFileVersion(flFile)
  240.       swFile = baSysFolder("system") & "Macromed\Director\SwDir.dll"
  241.       swExist = baFileExists(swFile)
  242.       swVers = baFileVersion(swFile)
  243.     end if
  244.   else
  245.     if isMac then
  246.       brwPluginFolder = getDir(brwPath) & "Plug-ins:"
  247.       flFile = brwPluginFolder & "Shockwave Flash NP-PPC"
  248.       flExist = baFileExists(flFile)
  249.       flVers = baFileVersion(flFile)
  250.       swFile = brwPluginFolder & "NP-PPC-Dir-Shockwave"
  251.       swExist = baFileExists(swFile)
  252.       swVers = baFileVersion(swFile)
  253.     else
  254.       brwPluginFolder = getDir(brwPath) & "plugins\"
  255.       flFile = brwPluginFolder & "NPSWF32.dll"
  256.       flExist = baFileExists(flFile)
  257.       flVers = baFileVersion(flFile)
  258.       swFile = brwPluginFolder & "np32dsw.dll"
  259.       swExist = baFileExists(swFile)
  260.       swVers = baFileVersion(swFile)
  261.     end if
  262.   end if
  263.   SWpresent = swExist and (swVers.char[1] >= gRequired[#vSW])
  264.   FLpresent = flExist and (flVers.char[1] >= gRequired[#vFL])
  265.   plugins[#Ok] = FLpresent and SWpresent
  266.   return plugins
  267. end
  268.  
  269. on detectScreenResolution
  270.   screenRes = [:]
  271.   screenRes[#Ok] = getAt(getAt(the desktopRectList, 1), 3) >= gRequired[#W]
  272.   return screenRes
  273. end
  274.  
  275. on getDir filePath
  276.   D = "\"
  277.   if isMac then
  278.     D = ":"
  279.   end if
  280.   repeat while (filePath.length > 0) and (filePath.char[filePath.length] <> D)
  281.     delete char -30000 of filePath
  282.   end repeat
  283.   return filePath
  284. end
  285.  
  286. on getFile filePath
  287.   D = "\"
  288.   if isMac then
  289.     D = ":"
  290.   end if
  291.   repeat while (filePath.length > 0) and (filePath contains D)
  292.     delete filePath.char[1]
  293.   end repeat
  294.   return filePath
  295. end
  296.  
  297. on doInstall
  298.   case the frameLabel of
  299.     "no browser":
  300.       doInstallBrowser()
  301.     "no flash":
  302.       doInstallPlugins()
  303.   end case
  304. end
  305.  
  306. on doInstallIcon
  307. end
  308.  
  309. on doFinish
  310.   cursor(-1)
  311.   if the frameLabel <> "did not install" then
  312.     doInstallIcon()
  313.   end if
  314.   doQuit()
  315. end
  316.  
  317. on doLaunch
  318.   self = baActiveWindow()
  319.   doInstallIcon()
  320.   if self <> baActiveWindow() then
  321.     baActivateWindow(self)
  322.   end if
  323.   cursor(-1)
  324.   gotoNetPage(gWebPage[#mainPage])
  325.   doQuit()
  326. end
  327.  
  328. on doOpenDisclaimer
  329.   self = baActiveWindow()
  330.   if gOpenDefaultBrowser then
  331.     gotoNetPage(gDisclaimer)
  332.   else
  333.     if isMac then
  334.       Ok = baOpenFile(gDisclaimer & "l", EMPTY)
  335.     else
  336.       Ok = baShell("open", gBrowser[#Path], gDisclaimer, EMPTY, "normal")
  337.     end if
  338.   end if
  339.   if self <> baActiveWindow() then
  340.     baActivateWindow(self)
  341.   end if
  342.   cursor(-1)
  343.   doQuit()
  344. end
  345.  
  346. on doHelpDesk
  347.   gotoNetPage(gWebPage[#help_desk])
  348. end
  349.  
  350. on doShortcut
  351.   doInstallIcon()
  352.   cursor(-1)
  353.   doQuit()
  354. end
  355.  
  356. on doRestartCD
  357.   gotoNextStep()
  358. end
  359.  
  360. on doInstallBrowser
  361.   if gInstallerSelected = 1 then
  362.     if isMac then
  363.       doInstallIcon()
  364.       open(gInstaller[#IE])
  365.     else
  366.       cursor(4)
  367.       gPlugins = detectPlugins(EMPTY, "IE")
  368.       cursor(-1)
  369.       if not gPlugins[#Ok] then
  370.         alert("The CD-ROM will now install Flash 4.0, so that you can take advantage " & RETURN & "of the interactivity of mypatient.com." & RETURN & RETURN & "It will then proceed to the regular installation of Internet Explorer.")
  371.         err = baRunProgram(gInstaller[#PL], "normal", 1)
  372.         if err < 32 then
  373.           alert("An error occured while running plug-in installer:" & RETURN & getError("baRunProgram", err) & RETURN & RETURN & "Please try again.")
  374.         end if
  375.         cursor(4)
  376.         gPlugins = detectPlugins(EMPTY, "IE")
  377.         cursor(-1)
  378.       end if
  379.       if not gPlugins[#Ok] then
  380.         nextScreen = "did not install"
  381.       else
  382.         doInstallIcon()
  383.         err = baRunProgram(gInstaller[#IE], "normal", 1)
  384.         if err < 32 then
  385.           alert("An error occured while running Internet Explorer installer:" & RETURN & getError("baRunProgram", err) & RETURN & RETURN & "Please try again.")
  386.         end if
  387.       end if
  388.       cursor(-1)
  389.     end if
  390.   else
  391.     if isMac then
  392.       doInstallIcon()
  393.       open(gInstaller[#NS])
  394.     else
  395.       doInstallIcon()
  396.       err = baRunProgram(gInstaller[#NS], "normal", 1)
  397.       if err < 32 then
  398.         alert("An error occured while running plug-in installer:" & RETURN & getError("baRunProgram", err) & RETURN & RETURN & "Please try again.")
  399.       end if
  400.     end if
  401.   end if
  402.   nextScreen = "exit"
  403.   if 0 then
  404.     cursor(4)
  405.     gBrowser = detectBrowser(EMPTY)
  406.     gPlugins = detectPlugins(gBrowser[#Path], gBrowser[#type])
  407.     gScreenRes = detectScreenResolution()
  408.     alert("Browser detected[" & gBrowser[#Ok] & "] versionOK[" & gBrowser[#vOK] & "] path[" & gBrowser[#Path] & "] type[" & gBrowser[#type] & "]")
  409.     if not gBrowser[#Ok] then
  410.       nextScreen = "did not install"
  411.     else
  412.       if not gPlugins[#Ok] then
  413.         nextScreen = "no flash"
  414.       else
  415.         if not gScreenRes[#Ok] then
  416.           nextScreen = "not 800x600"
  417.         else
  418.           nextScreen = "install"
  419.         end if
  420.       end if
  421.     end if
  422.     cursor(-1)
  423.   end if
  424. end
  425.  
  426. on doInstallPlugins
  427.   alert("After the installation," & RETURN & "please restart the program.")
  428.   if isMac then
  429.     open(gInstaller[#PL])
  430.   else
  431.     err = baRunProgram(gInstaller[#PL], "normal", 1)
  432.     if err < 32 then
  433.       alert("An error occured while running plug-in installer:" & RETURN & getError("baRunProgram", err) & RETURN & RETURN & "Please try again.")
  434.     end if
  435.   end if
  436.   doQuit()
  437. end
  438.  
  439. on doInstallBrowser_IE
  440.   msg = "This will copy 'Internet Explorer 5.smi' on your desktop." & RETURN
  441.   msg = msg & "Open that file and follow instructions to install the" & RETURN
  442.   msg = msg & "browser. After the installation is completed," & RETURN & RETURN
  443.   msg = msg & "Then please restart the program."
  444.   alert(msg)
  445.   gInstallerSelected = 1
  446.   doInstallBrowser()
  447.   doQuit()
  448. end
  449.  
  450. on doInstallBrowser_NS
  451.   msg = "After the browser installation is completed," & RETURN
  452.   msg = msg & "please open your newly installed Netscape and" & RETURN
  453.   msg = msg & "select 'Yes' when prompted to choose it as the" & RETURN
  454.   msg = msg & "default browser." & RETURN & RETURN
  455.   msg = msg & "Then please restart the program."
  456.   alert(msg)
  457.   gInstallerSelected = 2
  458.   doInstallBrowser()
  459.   doQuit()
  460. end
  461.  
  462. on getError errType, errNo
  463.   case errType of
  464.     "baCreatePMGroup":
  465.       str = "Unable to make the Start Menu group"
  466.     "baCreatePMIcon":
  467.       str = "Unable to make the Start Menu icon"
  468.     "baCopyFile":
  469.       case errNo of
  470.         1:
  471.           str = "Invalid Source file name"
  472.         2:
  473.           str = "Invalid Destination file name"
  474.         3:
  475.           str = "Error reading the Source file"
  476.         4:
  477.           str = "Error writing the Destination file"
  478.         5:
  479.           str = "Couldn't create directory for Destination file"
  480.         6:
  481.           str = "Destination file exists"
  482.         7:
  483.           str = "Destination file is newer that Source file"
  484.       end case
  485.     "baRunProgram":
  486.       case errNo of
  487.         0:
  488.           str = "System was out of memory, executable file was corrupt, or relocations were invalid."
  489.         1:
  490.           str = "Unspecified error."
  491.         2:
  492.           str = "File was not found."
  493.         3:
  494.           str = "Path was not found."
  495.         5:
  496.           str = "Attempt was made to dynamically link to a task, or there was a sharing or network-protection error."
  497.         6:
  498.           str = "Library required separate data segments for each task."
  499.         8:
  500.           str = "There was insufficient memory to start the application."
  501.         10:
  502.           str = "Windows version was incorrect."
  503.         11:
  504.           str = "Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image."
  505.         12:
  506.           str = "Application was designed for a different operating system."
  507.         13:
  508.           str = "Application was designed for MS-DOS 4.0."
  509.         14:
  510.           str = "Type of executable file was unknown."
  511.         15:
  512.           str = "Attempt was made to load a real-mode application (developed for an earlier version of Windows)."
  513.         16:
  514.           str = "Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only."
  515.         19:
  516.           str = "Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded."
  517.         20:
  518.           str = "Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt."
  519.         21:
  520.           str = "Application requires 32-bit extensions."
  521.       end case
  522.   end case
  523.   return str
  524. end
  525.  
  526. on doQuit
  527.   quit()
  528. end
  529.  
  530. on doCancel
  531.   doQuit()
  532. end
  533.